package Pattern.prototype.code;

import java.util.Hashtable;

public class PrototypeManger {
    Canvas canvas = new Canvas();
    Brush brush = new Brush();
    Hashtable<String, Color> colorTable = new Hashtable<>();

    public PrototypeManger(){
        colorTable.put("pink", new ColorPink());
        colorTable.put("black", new ColorBlack());
        colorTable.put("white", new ColorWhite());
        colorTable.put("blue", new ColorBlue());
    }

    public Canvas getCanvas() throws CloneNotSupportedException {
        return canvas.clone();
    }

    public Brush getBrush() throws CloneNotSupportedException {
        return brush.clone();
    }

    public Color getColor(String des){
        return colorTable.get(des);
    }
}
